package com.deryun.tyl.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.deryun.tyl.bean.Industry;
import com.deryun.tyl.service.impl.IndustryServiceImpl;

@Controller
@RequestMapping("industry")
public class IndustryController {
	
	@Resource(name = "industryServiceImpl")
	private IndustryServiceImpl industryServiceImpl;
	
	@RequestMapping("/getAllIndustry")
	public List<Industry> getAllIndustry(){
		return industryServiceImpl.getAllIndustry();
	}
	
	/***
	 * 添加行业动态
	 * @param industry
	 * @return 返回页面路径
	 */
	@RequestMapping("/addIndustry")
	public String addIndustry(Industry industry){
		int result = industryServiceImpl.addIndustry(industry);
		if (result == 1) {
			return "back_admin_manger/hydt_add";//添加成功后返回的页面
		}
		return "back_admin_manger/hydt_add";//添加失败后返回的页面
	}
	
	/***
	 * 删除行业动态
	 * @param id
	 * @return 返回页面路径
	 */
	@RequestMapping("/deleteIndustry")
	public String deleteIndustry(int id){
		int result = industryServiceImpl.deleteIndustry(id);
		if (result == 1) {
			return "success";//删除成功后返回的页面
		}
		return "false";//删除失败后返回的页面
	}
}
